package com.cskaoyan.javase.other._2enum;

/**
 * 枚举类型,它本质上还是一个类,但是它定义的关键字不适用class,而使用enum关键字
 * 枚举类型的作用,相当于在一个类当中定义常量.
 *
 * @since 14:16
 * @author wuguidong@cskaoyan.onaliyun.com
 */
public class Demo {
    public static void main(String[] args) {
        test(WeekDayNum.FRIDAY);
        test(1000);

        test2(WeekDayNumEnum.THURSDAY);
        // test2(100);
    }

    public static void test(int weekDayNum) {
        switch (weekDayNum) {
            case 1:
                break;
            case 2:
                break;
            // ...
            case 7:
                break;
        }
    }

    public static void test2(WeekDayNumEnum weekDay) {
        switch (weekDay) {
            case MONDAY:
                System.out.println("睡觉!");
                break;
            case TUESDAY:
                System.out.println("睡觉!");
                break;
            case WEDNESDAY:
                System.out.println("睡觉!");
                break;
            case THURSDAY:
                System.out.println("吃肯德基!");
                break;
            case FRIDAY:
                break;
            case SATURDAY:
                break;
            case SUNDAY:
                break;
        }
    }

}

// 枚举类型，使用关键字enum
enum WeekDayNumEnum {
    MONDAY, TUESDAY, WEDNESDAY,
    THURSDAY, FRIDAY, SATURDAY, SUNDAY
}

class WeekDayNum {
    public static final int MONDAY = 1;
    public static final int TUESDAY = 2;
    public static final int WEDNESDAY = 3;
    public static final int THURSDAY = 4;
    public static final int FRIDAY = 5;
    public static final int SATURDAY = 6;
    public static final int SUNDAY = 7;
}
